home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_procmail.idb / usr / freeware / catman / u_man / cat5 / procmailsc.Z / procmailsc
Encoding:
Text File  |  1998-10-28  |  11.5 KB  |  332 lines

  1. /xlv1/freeware/1998.Oct/procmail/3.11pre7/procmail-3.11pre7.diffbuild/new
  2.  
  3.  
  4.  
  5.      PPPPRRRROOOOCCCCMMMMAAAAIIIILLLLSSSSCCCC((((5555))))       BBBBuuuuGGGGlllleeeessssssss ((((1111999999994444////11110000////00007777))))         PPPPRRRROOOOCCCCMMMMAAAAIIIILLLLSSSSCCCC((((5555))))
  6.  
  7.  
  8.  
  9.      NNNNAAAAMMMMEEEE
  10.       procmailsc - procmail    weighted scoring techique
  11.  
  12.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  13.       [****] wwww^^^^xxxx ccccoooonnnnddddiiiittttiiiioooonnnn
  14.  
  15.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  16.       In addition to the traditional true or false conditions  you
  17.       can  specify    on  a  recipe,    you can    use a weighted scoring
  18.       technique to decide if a  certain  recipe  matches  or  not.
  19.       When    weighted  scoring  is used in a    recipe,    then the final
  20.       score    for that recipe    must be    positive for it    to match.
  21.  
  22.       A certain condition can  contribute  to  the    score  if  you
  23.       allocate  it    a  `weight' (wwww)    and an `exponent' (xxxx).    You do
  24.       this by preceding the    condition (on the same line) with:
  25.            wwww^^^^xxxx
  26.       Whereas both wwww and xxxx are real    numbers    between     -2147483647.0
  27.       and 2147483647.0.
  28.  
  29.  
  30.      WWWWeeeeiiiigggghhhhtttteeeedddd rrrreeeegggguuuullllaaaarrrr eeeexxxxpppprrrreeeessssssssiiiioooonnnn ccccoooonnnnddddiiiittttiiiioooonnnnssss
  31.       The first time the regular expression    is found, it will  add
  32.       _w  to     the  score.  The second time it is found, _w*_x will be
  33.       added.  The third time it is found,  _w*_x*_x  will  be    added.
  34.       The fourth time _w*_x*_x*_x will be added.  And so forth.
  35.  
  36.       This can be described    by the following concise formula:
  37.  
  38.                     n
  39.             n    k-1       x - 1
  40.            w * Sum x    = w    * -------
  41.            k=1           x - 1
  42.  
  43.       It represents    the total added    score for this condition if  nnnn
  44.       matches are found.
  45.  
  46.       Note that the    following case distinctions can    be made:
  47.  
  48.       x=0      Only the first match will contribute w to the    score.
  49.           Any subsequent matches are ignored.
  50.  
  51.       x=1      Every    match will contribute the same w to the    score.
  52.           The  score grows linearly with the number of matches
  53.           found.
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.      Page 1                         (printed 8/25/98)
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.      PPPPRRRROOOOCCCCMMMMAAAAIIIILLLLSSSSCCCC((((5555))))       BBBBuuuuGGGGlllleeeessssssss ((((1111999999994444////11110000////00007777))))         PPPPRRRROOOOCCCCMMMMAAAAIIIILLLLSSSSCCCC((((5555))))
  72.  
  73.  
  74.  
  75.       0<x<1      Every    match will contribute less to the  score  than
  76.           the  previous     one.    The  score will    asymptotically
  77.           approach a certain  value  (see  the    NNNNOOOOTTTTEEEESSSS  section
  78.           below).
  79.  
  80.       1<x      Every    match will contribute more to the  score  than
  81.           the     previous    one.    The   score   will      grow
  82.           exponentionally.
  83.  
  84.       x<0      Can be utilised to favour  odd  or  even  number  of
  85.           matches.
  86.  
  87.       If the regular expression is negated    (i.e.  matches    if  it
  88.       isn't    found),    then nnnn obviously can either be zero or one.
  89.  
  90.      WWWWeeeeiiiigggghhhhtttteeeedddd pppprrrrooooggggrrrraaaammmm ccccoooonnnnddddiiiittttiiiioooonnnnssss
  91.       If the program returns an  exitcode  of  EXIT_SUCCESS     (=0),
  92.       then    the  total  added  score will be wwww.  If    it returns any
  93.       other    exitcode (indicating failure), the total  added     score
  94.       will be xxxx.
  95.  
  96.       If the  exitcode  of    the  program  is  negated,  then,  the
  97.       exitcode  will  be considered    as if it were a    virtual    number
  98.       of matches.  Calculation of the added    score then proceeds as
  99.       if it    had been a normal regular expression with nnnn====````eeeexxxxiiiittttccccooooddddeeee''''
  100.       matches.
  101.  
  102.      WWWWeeeeiiiigggghhhhtttteeeedddd lllleeeennnnggggtttthhhh ccccoooonnnnddddiiiittttiiiioooonnnnssss
  103.       If the length    of the actual mail is MMMM    then:
  104.  
  105.            * w^x  >    L
  106.  
  107.       will generate    an additional score of:
  108.  
  109.               1
  110.            /  M     \
  111.            w * | --- |
  112.            \  L     /
  113.  
  114.       And:
  115.  
  116.            * w^x  <    L
  117.  
  118.       will generate    an additional score of:
  119.  
  120.               1
  121.            /  L     \
  122.            w * | --- |
  123.            \  M     /
  124.  
  125.       In both cases, if L=M, this will add w to the    score.    In the
  126.       former  case    however, larger    mails will be favoured,    in the
  127.  
  128.  
  129.  
  130.      Page 2                         (printed 8/25/98)
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.      PPPPRRRROOOOCCCCMMMMAAAAIIIILLLLSSSSCCCC((((5555))))       BBBBuuuuGGGGlllleeeessssssss ((((1111999999994444////11110000////00007777))))         PPPPRRRROOOOCCCCMMMMAAAAIIIILLLLSSSSCCCC((((5555))))
  138.  
  139.  
  140.  
  141.       latter case, smaller mails will be favoured.    Although x can
  142.       be  varied  to  fine-tune  the  steepness  of     the function,
  143.       typical usage    sets x=1.
  144.  
  145.      MMMMIIIISSSSCCCCEEEELLLLLLLLAAAANNNNEEEEOOOOUUUUSSSS
  146.       You can query    the final score    of all    the  conditions     on  a
  147.       recipe  from    the environment    variable $$$$====.  This variable is
  148.       set _e_v_e_r_y time just after procmail has parsed    all conditions
  149.       on a recipe (even if the recipe is not being executed).
  150.  
  151.      EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
  152.       The following    recipe will ditch all mails having  more  than
  153.       150  lines  in  the  body.   The first condition contains an
  154.       empty    regular    expression which, because it  always  matches,
  155.       is  used  to    give  our score    a negative offset.  The    second
  156.       condition then matches every line in the mail, and  consumes
  157.       up  the  previous  negative  offset  we  gave    (one point per
  158.       line).  In the end, the score    will only be positive  if  the
  159.       mail contained more than 150 lines.
  160.  
  161.            :0 Bh
  162.            * -150^0
  163.            *    1^1     ^.*$
  164.            /dev/null
  165.  
  166.       Suppose you have a priority folder  which  you  always  read
  167.       first.   The    next  recipe  picks  out the priority mail and
  168.       files    them in    this special folder.  The first    condition is a
  169.       regular  one,     i.e.  it doesn't contribute to    the score, but
  170.       simply has to    be satisfied.  The other  conditions  describe
  171.       things   like:   john     and  claire  usually  have  something
  172.       important to say, meetings are  usually  important,  replies
  173.       are  favoured     a  bit,  mails    about Elvis (this is merely an
  174.       example :-) are favoured (the    more he    is mentioned, the more
  175.       the  mail  is     favoured,  but    the maximum extra score    due to
  176.       Elvis    will be    4000, no matter    how often  he  is  mentioned),
  177.       lots    of  quoted lines are disliked, smileys are appreciated
  178.       (the score for those will reach a maximum  of     3500),     those
  179.       three    people usually don't send interesting mails, the mails
  180.       should preferably be small (e.g. 2000    bytes long mails  will
  181.       score     -100, 4000 bytes long mails do    -800).    As you see, if
  182.       some of the uninteresting people send    mail,  then  the  mail
  183.       still     has  a    chance of landing in the priority folder, e.g.
  184.       if it    is about a meeting, or if it  contains    at  least  two
  185.       smileys.
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.      Page 3                         (printed 8/25/98)
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.      PPPPRRRROOOOCCCCMMMMAAAAIIIILLLLSSSSCCCC((((5555))))       BBBBuuuuGGGGlllleeeessssssss ((((1111999999994444////11110000////00007777))))         PPPPRRRROOOOCCCCMMMMAAAAIIIILLLLSSSSCCCC((((5555))))
  204.  
  205.  
  206.  
  207.            :0 HB
  208.            *     !^Precedence:.*(junk|bulk)
  209.            * 2000^0      ^From:.*(john@home|claire@work)
  210.            * 2000^0      ^Subject:.*meeting
  211.            *  300^0      ^Subject:.*Re:
  212.            * 1000^.75 elvis|presley
  213.            * -100^1      ^>
  214.            *  350^.9  :-\)
  215.            * -500^0      ^From:.*(boss|jane|henry)@work
  216.            * -100^3      > 2000
  217.            priority_folder
  218.  
  219.       If you are subscribed    to a mailinglist, and just would  like
  220.       to  read the quality mails, then the following recipes could
  221.       do the trick.     First we make sure that the  mail  is    coming
  222.       from    the  mailinglist.  Then    we check if it is from certain
  223.       persons of whom we value the opinion,    or about a subject  we
  224.       absolutely  want  to    know everything    about.    If it is, file
  225.       it.  Otherwise, check     if  the  ratio     of  quoted  lines  to
  226.       original  lines  is  at most 1:2.  If    it exceeds that, ditch
  227.       the mail.  Everything    that survived the  previous  test,  is
  228.       filed.
  229.  
  230.            :0
  231.            ^From mailinglist-request@some.where
  232.            {
  233.          :0:
  234.          * ^(From:.*(paula|bill)|Subject:.*skiing)
  235.          mailinglist
  236.  
  237.          :0 Bh
  238.          *  20^1 ^>
  239.          * -10^1 ^[^>]
  240.          /dev/null
  241.  
  242.          :0:
  243.          mailinglist
  244.            }
  245.  
  246.       For further examples you should look    in  the     pppprrrrooooccccmmmmaaaaiiiilllleeeexxxx(5)
  247.       man page.
  248.  
  249.      CCCCAAAAVVVVEEEEAAAATTTTSSSS
  250.       Because this speeds up the search by an order    of  magnitude,
  251.       the  procmail     internal  egrep  will    always    search for the
  252.       leftmost _s_h_o_r_t_e_s_t match, unless it is     determining  what  to
  253.       assign  to  MMMMAAAATTTTCCCCHHHH,  in  which     case it searches the leftmost
  254.       _l_o_n_g_e_s_t match.  E.g. for the    leftmost  _s_h_o_r_t_e_s_t  match,  by
  255.       itself, the regular expression:
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.      Page 4                         (printed 8/25/98)
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.      PPPPRRRROOOOCCCCMMMMAAAAIIIILLLLSSSSCCCC((((5555))))       BBBBuuuuGGGGlllleeeessssssss ((((1111999999994444////11110000////00007777))))         PPPPRRRROOOOCCCCMMMMAAAAIIIILLLLSSSSCCCC((((5555))))
  270.  
  271.  
  272.  
  273.       ....****   will always match a zero     length     string     at  the  same
  274.            spot.
  275.  
  276.       ....++++   will always match one  character     (except  newlines  of
  277.            course).
  278.  
  279.      SSSSEEEEEEEE AAAALLLLSSSSOOOO
  280.       pppprrrrooooccccmmmmaaaaiiiillll(1), pppprrrrooooccccmmmmaaaaiiiillllrrrrcccc(5), pppprrrrooooccccmmmmaaaaiiiilllleeeexxxx(5), sssshhhh(1), ccccsssshhhh(1),
  281.       eeeeggggrrrreeeepppp(1), ggggrrrreeeepppp(1),
  282.  
  283.      BBBBUUUUGGGGSSSS
  284.       If, in a length condition, you specify an xxxx that  causes  an
  285.       overflow, procmail is    at the mercy of    the ppppoooowwww(3) function in
  286.       your mathematical library.
  287.  
  288.       Floating point numbers in `engineering' format  (e.g.     12e5)
  289.       are not accepted.
  290.  
  291.      MMMMIIIISSSSCCCCEEEELLLLLLLLAAAANNNNEEEEOOOOUUUUSSSS
  292.       As soon as `plus infinity' (2147483647) is reached, any sub-
  293.       sequent _w_e_i_g_h_t_e_d conditions will simply be skipped.
  294.  
  295.       As soon as `minus infinity' (-2147483647)  is     reached,  the
  296.       condition  will  be  considered as `no match'    and the    recipe
  297.       will terminate early.
  298.  
  299.      NNNNOOOOTTTTEEEESSSS
  300.       If in    a regular expression weighted formula 0000<<<<xxxx<<<<1111, the total
  301.       added    score for this condition will asymptotically approach:
  302.  
  303.           w
  304.            -------
  305.         1 - x
  306.  
  307.       In order to reach half the maximum value you need
  308.  
  309.             - ln 2
  310.            n = --------
  311.               ln x
  312.  
  313.       matches.
  314.  
  315.      AAAAUUUUTTTTHHHHOOOORRRR
  316.       Stephen R. van den Berg
  317.            <srb@cuci.nl>
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.      Page 5                         (printed 8/25/98)
  329.  
  330.  
  331.  
  332.